<template>
<!-- 没有Home键，使用Fn+左箭头 -->
  <van-action-sheet v-if="detail" :value="visable" @input="$emit('close',false)" @cancel="$emit('close',false)" @close="$emit('close', false)"  title="标题" close-icon="close">
    <div class="cart-content">
      <div class="cart-header clearfix">
        <div class="left" v-if="detail">
          <img :src="detail.goods_image" alt="">
        </div>
        <div class="right">
          <div class="price red">{{detail.skuList[0].goods_price}}</div>
          <span class="stock">库存：{{detail.skuList[0].stock_num}}</span>
        </div>
      </div>

      <div class="cart-num">
        <van-cell value="数量">
          <template #extra>
            <CountBox></CountBox>
          </template>
        </van-cell>
      </div>

      <slot name="cart-footer"></slot>
    </div>
 </van-action-sheet>
</template>

<script>
import CountBox from '@/components/CountBox.vue'
export default {
  name: 'CartPannel',
  components: {
    CountBox
  },
  props: {
    visable: {
      type: Boolean,
      default: false
    },
    detail: {
      type: Object,
      default: () => {

      }
    }
  }
}
</script>

<style lang="less" scoped>
// 购物车面板
  ::v-deep .van-action-sheet__header {
    font-size: 0;
  }
.cart-content {
  padding: 20px;

  .cart-header {
    margin-bottom: 30px;
    .left {
      float: left;
      margin: 10px;
      width: 100px;
      height: 100px;

      img {
        width: 100%;
      }
    }
    .right {
      float: left;

      .price {
        margin-top: 26px;
        height: 45px;
        line-height: 45px;
        font-size: 30px;
      }

      .stock {
        font-size: 16px;
        padding-left: 4px;
      }
    }
  }
}

.cart-num {
  margin: 15px;
}

.cart-footer {
  margin: 30px;
}
</style>
